class Bus{
    constructor(){
        this.cacheBlocks = new Set()
    }

    addSnooper(cacheBlock){
        this.cacheBlocks.add(cacheBlock)
    }    

    deleteSnooper(cacheBlock){
        this.cacheBlocks.delete(cacheBlock)
    }


    busRd(host){
        for(let cb of this.cacheBlocks){
            if(cb !== host && cb.content === host.content)cb.busRd()
        }
    }

    busRdX(host){
        for(let cb of this.cacheBlocks){
            if(cb !== host && cb.content === host.content)cb.busRdX()
        }
    }
}

module.exports = new Bus()